package com.hemerasolutions.v2trainer.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.MessageSource;

import com.hemerasolutions.v2trainer.dao.interfaces.PhotoDaoInterface;
import com.hemerasolutions.v2trainer.dao.interfaces.VideoDaoInterface;
import com.hemerasolutions.v2trainer.model.multimedia.Photo;
import com.hemerasolutions.v2trainer.service.interfaces.BaseServiceInterface;



/**
 * @author ryegros
 * Base operations for Service Layer
 */

public class BaseService implements BaseServiceInterface {

	private static final long serialVersionUID = 1L;
	
    @Autowired
	protected MessageSource message;
    
    @Autowired
    private PhotoDaoInterface photoDao;
    
    @Autowired
    private VideoDaoInterface videoDao;
    
    
	@Override
	public String localizedText(String id){

		return this.message.getMessage(id,null,null);

	}
	
	@Override
	public MessageSource getMessage() {
		return message;
	}

	@Override
	public void setMessage(MessageSource message) {
		this.message = message;
	}

	@Override
	public long getSerialversionuid() {
		return serialVersionUID;
	}
	
	@Override
	public String persistPhotoInFile(Photo photo){
		return photoDao.persistInFile(photo);
	}
	
}
